package com.beone.smart.smartBeauty.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.beone.smart.smartBeauty.model.entity.SkinGatherDO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.HashMap;

@Repository
public interface SkinGatherDao extends BaseMapper<SkinGatherDO> {
    @Select("SELECT sum(xiwen+maokong+fuse+seban+tanxin+doudou)/count(*)/6 as  total, avg(xiwen) xiwen,avg(maokong) maokong,"
            + " avg(fuse) fuse,avg(seban) seban,avg(tanxin) tanxin,avg(doudou) doudou FROM skin_gather ")
    HashMap<String, Double> skinGatherCount();

    @Select("SELECT * FROM skin_gather where userId =#{uid} ORDER BY recordDate desc  limit 1 ")
    SkinGatherDO personCount(@Param("uid") String uid);

    @Select("SELECT sum(xiwen+maokong+fuse+seban+tanxin+doudou)/count(*)/6 as  zonghe FROM skin_gather where userId =#{uid} ORDER BY recordDate desc  limit 1 ")
    HashMap<String, Double> personZongheCount(@Param("uid") String uid);
}
